package kr.hkit.powerjava.chapter24.submit3;

import java.io.Serializable;

public class Department_Vo implements Serializable, Comparable<Department_Vo> {

	private int deptNum;
	private String deptName;
	private int floor;

	public Department_Vo(int deptNum, String deptName) {
		this.deptNum = deptNum;
		this.deptName = deptName;
	}

	public Department_Vo(int deptNum, String deptName, int floor) {
		this.deptNum = deptNum;
		this.deptName = deptName;
		this.floor = floor;
	}

	public int getDeptNum() {
		return deptNum;
	}

	public void setDeptNum(int deptNum) {
		this.deptNum = deptNum;
	}

	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public int getFloor() {
		return floor;
	}

	public void setFloor(int floor) {
		this.floor = floor;
	}

	@Override
	public String toString() {
		return String.format("%3s\t%5s\t%3s", deptNum, deptName, floor);
	}

	@Override
	public int compareTo(Department_Vo o) { // 기본정렬
		return deptNum - o.deptNum;
	}

	@Override
	public boolean equals(Object obj) {
		boolean result =false;
		if (obj instanceof Department_Vo) {
			Department_Vo temp = (Department_Vo) obj;
			result = ((deptNum==temp.deptNum && deptName.equals(temp.deptName)));
		}
		return result;
	}
}
